class Person{

    get name() {
        return this.age;
    }

    // 这里只能set其他的属性,不能只set name属性不然会进入死循环
    set name(name) {
        this.age = age;
    }
}

let person = new Person();
person.age = 'Alice'
console.log(person.age);